Repository navigation
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
groupByloses the group when the iteratee returns__proto__:The assignment calls the inherited
__proto__setter instead of creating a group. Each matching item then replaces the previous one. Define an own property when starting a group, while keeping the result a normal object.The tests cover
groupBy,groupByLimit, andgroupBySeries, with callbacks and promises. They also checkconstructor,toString, andhasOwnPropertygroups. All six new cases fail before the fix.Checks on macOS:
npm test: lint and all 709 tests pass on Node 20.20.2 and 25.2.1.npm run coverage: 706 tests pass on Node 20.20.2;groupByLimit.jshas full coverage.network.proxy.type=0); repository test files and configuration are unchanged.make build-modulesfails on both unchanged master and this branch becauseyargs.argvis undefined insupport/build/compile-module.js. No build files were changed.There is a cost to defining each new group this way. In a local synchronous-iteratee benchmark over 1,000 items, the median time went from 0.053 ms to 0.060 ms with 10 groups, and from 0.162 ms to 0.322 ms with 1,000 distinct groups. These are microbenchmark results, not measurements of an I/O workload. Using
definePropertykeeps normal object behavior and also handles keys that coerce to__proto__.Prepared with OpenAI Codex, including the investigation, code, and tests.